Release 10.1A: OpenEdge Development:
Web Services
StockQuotes sample walk-through
StockQuotes.pfollows these steps to prepare, call, and process the output from a quote request (source code edited and formatted for clarity):
- Prompts for the stock symbol(s) to populate the XML document entered using the Enter Stock Symbols prompt:
- Creates a Web service object in the 4GL:
- Connects to the Web service (which has only one valid service and port):
- Sets the handle to the port type in the WSDL where the Web service operation is defined and waits for the user to invoke the request:
- When the user clicks the getQuote button,
StockQuotes.p:
- Constructs the XML document that is input to the Web service operation. The document is created in this form:
This is the code, which also saves the document as a
LONGCHAR:
- Invokes the
GetStockQuotesoperation in the Web service by making a procedure call:
- Checks for errors and manages the information for any that occur (see the "Common procedure for SOAP fault handling" section):
- If there are no errors, loads the XML document that was passed back as a
LONGCHAROUTPUTparameter:
- The Web service returns the output XML document with the following structure (shown for a single quote example, PRGS):
The client then parses this document to get the relevant information and put it into a
CHARACTERvariable for display:
- Displays the
CHARACTERvariable containing the data in anEDITORwidget:
- Cleans up by running this code:
Which:
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |